let fs = require('fs');
fs.readFile('./1.txt', 'utf8', function(err, data) {
    let csvData = "";
    let dataArray = eval(data);
    dataArray.forEach(T => {
        for (let key in T) {
            csvData = csvData += T[key] + ","
        }
        csvData = csvData.substr(0, csvData.length - 1) + "\n"
    });
    fs.writeFile('./message.csv', csvData, function(err) {
        if (err) {
            console.log('写文件操作失败');
        } else {
            console.log('写文件操作成功');
        }
    })
});